<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/algorithm/linear/linked/sllnk.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/algorithm/linear/linked/sllnk.h</h1>  </div>
</div>
<div class="contents">
<a href="sllnk_8h.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef __NV_SLLNK__</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __NV_SLLNK__</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="cdef_8h.html" title="Definitions and declarations for common constants, types, variables.">../../../port/cdef.h</a>&quot;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00022"></a>00022 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00023"></a>00023 
<a name="l00040"></a><a class="code" href="struct____sllnk__node.html">00040</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct____sllnk__node.html" title="单向线形链表节点">__sllnk_node</a> {
<a name="l00042"></a><a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966">00042</a>     <span class="keyword">struct </span><a class="code" href="struct____sllnk__node.html" title="单向线形链表节点">__sllnk_node</a>* <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00043"></a>00043 }<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa5bd6699bf7f21b319fe54d33c8b8134" title="节点">sllnk_node</a>, <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga39fa3e813e6a625efe53eaf0d93ce11b" title="表头">sllnk_head</a>, *<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga19922a45d34b561d1422277153911306" title="迭代器">sllnk_iter</a>;
<a name="l00044"></a>00044 
<a name="l00053"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6204e8e15b285f8c8f9338e6923c4603">00053</a> <span class="preprocessor">#define SLLNK_HEAD(name) sllnk_head name = {NULL}</span>
<a name="l00054"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad660429ac591bc2e11ac660f7fc99ef9">00054</a> <span class="preprocessor"></span><span class="preprocessor">#define SLLNK_NODE(name) sllnk_node name = {NULL}</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>
<a name="l00062"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6f2d9337131eea4f623e0cf80851222e">00062</a> <span class="keyword">typedef</span> int (*<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6f2d9337131eea4f623e0cf80851222e" title="单参数回调函数指针">sllnk_pr1</a>)(<a class="code" href="struct____sllnk__node.html" title="单向线形链表节点">sllnk_node</a>*);
<a name="l00063"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga792055c4019899e119e0effca0a439d9">00063</a> <span class="keyword">typedef</span> int (*<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga792055c4019899e119e0effca0a439d9" title="双参数回调函数指针">sllnk_pr2</a>)(<a class="code" href="struct____sllnk__node.html" title="单向线形链表节点">sllnk_node</a>*, sllnk_node*);
<a name="l00064"></a>00064 
<a name="l00076"></a>00076 NV_API <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf3a28f89d0fda0521c30210350488f87" title="判断链表结构是否正常">sllnk_check</a>(sllnk_head* head, sllnk_iter* loop_entry);
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="preprocessor">#define SLLNK_CHECK_PASS    0 </span><span class="comment">/* 正常 */</span>
<a name="l00079"></a>00079 <span class="preprocessor">#define SLLNK_CHECK_LOOP    1 </span><span class="comment">/* 有非法环路 */</span>
<a name="l00080"></a>00080 
<a name="l00092"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9db979ce8eb374bd90663f8198f7640c">00092</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9db979ce8eb374bd90663f8198f7640c" title="初始化表头">sllnk_init</a>(sllnk_head* head)
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094     head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = NULL;
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00111"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa9ec544e0a8ad92808fa2669ead6fa95">00111</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa9ec544e0a8ad92808fa2669ead6fa95" title="判断表是否为空">sllnk_empty</a>(sllnk_head* head)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113     <span class="keywordflow">return</span> !head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115 
<a name="l00116"></a>00116 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __sllnk_singular(sllnk_node* front)
<a name="l00117"></a>00117 {
<a name="l00118"></a>00118     <span class="keywordflow">return</span> (front &amp;&amp; !front-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120 
<a name="l00135"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga13cb4a8dee9d5a76883be42da95242d2">00135</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga13cb4a8dee9d5a76883be42da95242d2" title="判断表是否只有单个节点">sllnk_singular</a>(sllnk_head* head)
<a name="l00136"></a>00136 {
<a name="l00137"></a>00137     <span class="keywordflow">return</span> __sllnk_singular(head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00138"></a>00138 }
<a name="l00139"></a>00139 
<a name="l00162"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga64040e29b9c1ec653152659570049967">00162</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga64040e29b9c1ec653152659570049967" title="判断表是否可以排序">sllnk_sortable</a>(sllnk_iter begin, sllnk_iter end)
<a name="l00163"></a>00163 {
<a name="l00164"></a>00164     <span class="keywordflow">return</span> (begin != end &amp;&amp; begin-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> != end);
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 
<a name="l00196"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2fdf863715cfc6cd8b72da21d7cbfef">00196</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2fdf863715cfc6cd8b72da21d7cbfef" title="判断表是否可以序列化">sllnk_serialable</a>(sllnk_head* head)
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198     <span class="keywordflow">return</span> !!head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 
<a name="l00208"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga48f184f2bb9b0127577d0cf60aac9910">00208</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga48f184f2bb9b0127577d0cf60aac9910" title="链接两个节点">sllnk_link</a>(sllnk_iter prev, sllnk_iter <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>)
<a name="l00209"></a>00209 {   <span class="comment">/* 强制连接prev节点和next节点</span>
<a name="l00210"></a>00210 <span class="comment">     * --(prev)-&gt; &lt;-(next)-- ==&gt; --(prev)--(next)--</span>
<a name="l00211"></a>00211 <span class="comment">     */</span>
<a name="l00212"></a>00212     prev-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00213"></a>00213 }
<a name="l00214"></a>00214 
<a name="l00226"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga839ab5172ceae9b8850828d733dad8bb">00226</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga839ab5172ceae9b8850828d733dad8bb" title="在两个节点之间插入一个新节点">sllnk_insert_between</a>(sllnk_node* newly, 
<a name="l00227"></a>00227                                                 sllnk_iter prev, 
<a name="l00228"></a>00228                                                 sllnk_iter <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>)
<a name="l00229"></a>00229 {   <span class="comment">/* 强制连接prev节点和next节点，并在两者之间插入newly节点</span>
<a name="l00230"></a>00230 <span class="comment">     * (1) prev节点和next节点原来未连接 </span>
<a name="l00231"></a>00231 <span class="comment">     *       (newly)</span>
<a name="l00232"></a>00232 <span class="comment">     *                   ===&gt; --(prev)-(newly)-(next)--</span>
<a name="l00233"></a>00233 <span class="comment">     * --(prev) (next)--</span>
<a name="l00234"></a>00234 <span class="comment">     * (2) prev节点和next节点原来已连接 </span>
<a name="l00235"></a>00235 <span class="comment">     *       (newly)</span>
<a name="l00236"></a>00236 <span class="comment">     *                   ===&gt; --(prev)-(newly)-(next)--</span>
<a name="l00237"></a>00237 <span class="comment">     * --(prev)-(next)--</span>
<a name="l00238"></a>00238 <span class="comment">     */</span>
<a name="l00239"></a>00239     prev-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = newly;
<a name="l00240"></a>00240     newly-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00241"></a>00241     <span class="comment">/* (1)连接prev节点与newly节点  (2)再连接newly节点与next节点</span>
<a name="l00242"></a>00242 <span class="comment">     *          (newly)                    (newly)</span>
<a name="l00243"></a>00243 <span class="comment">     *          /                          /    \</span>
<a name="l00244"></a>00244 <span class="comment">     *    --(prev)  (next)--         --(prev)  (next)--</span>
<a name="l00245"></a>00245 <span class="comment">     */</span>
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247 
<a name="l00265"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga46ec6a361119752b8cfd6e9e96acb922">00265</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga46ec6a361119752b8cfd6e9e96acb922" title="插入节点到指定位置">sllnk_insert</a>(sllnk_iter prev, 
<a name="l00266"></a>00266                         sllnk_iter pos, sllnk_node* newly)
<a name="l00267"></a>00267 {
<a name="l00268"></a>00268     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga839ab5172ceae9b8850828d733dad8bb" title="在两个节点之间插入一个新节点">sllnk_insert_between</a>(newly, prev, pos);
<a name="l00269"></a>00269 }
<a name="l00270"></a>00270 
<a name="l00289"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4b7aa639ac401210a396f01293c5e002">00289</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4b7aa639ac401210a396f01293c5e002" title="擦除节点">sllnk_erase</a>(sllnk_iter prev, sllnk_iter entry)
<a name="l00290"></a>00290 {   <span class="comment">/* 将entry节点从表中移除</span>
<a name="l00291"></a>00291 <span class="comment">     *                              (entry)</span>
<a name="l00292"></a>00292 <span class="comment">     *  -(prev)-(entry)-()- ===&gt; </span>
<a name="l00293"></a>00293 <span class="comment">     *                           --(prev)--()--</span>
<a name="l00294"></a>00294 <span class="comment">     */</span>
<a name="l00295"></a>00295     prev-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = entry-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00296"></a>00296 }
<a name="l00297"></a>00297 
<a name="l00298"></a>00298 NV_API <span class="keywordtype">void</span> __sllnk_free(sllnk_iter begin, sllnk_iter end, 
<a name="l00299"></a>00299                         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6f2d9337131eea4f623e0cf80851222e" title="单参数回调函数指针">sllnk_pr1</a> erase_handler);
<a name="l00300"></a>00300 
<a name="l00312"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5a5b7fc4485177c98650d4e37c1c203c">00312</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5a5b7fc4485177c98650d4e37c1c203c" title="清空区域">sllnk_erases</a>(sllnk_iter bprev, sllnk_iter begin, 
<a name="l00313"></a>00313                             sllnk_iter end, <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6f2d9337131eea4f623e0cf80851222e" title="单参数回调函数指针">sllnk_pr1</a> erase_handler)
<a name="l00314"></a>00314 {
<a name="l00315"></a>00315     bprev-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = end;
<a name="l00316"></a>00316     <span class="keywordflow">if</span> (erase_handler)
<a name="l00317"></a>00317         __sllnk_free(begin, end, erase_handler);
<a name="l00318"></a>00318 }
<a name="l00319"></a>00319 
<a name="l00328"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2efa8b83e260b8089162cf07bcf1d1ac">00328</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2efa8b83e260b8089162cf07bcf1d1ac" title="清空表">sllnk_clear</a>(sllnk_head* head, <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6f2d9337131eea4f623e0cf80851222e" title="单参数回调函数指针">sllnk_pr1</a> erase_handler)
<a name="l00329"></a>00329 {
<a name="l00330"></a>00330     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5a5b7fc4485177c98650d4e37c1c203c" title="清空区域">sllnk_erases</a>(head, head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>, NULL, erase_handler);
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 
<a name="l00339"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae69537c14fd302544fc35320d1d46239">00339</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae69537c14fd302544fc35320d1d46239" title="在表首添加节点">sllnk_push_front</a>(sllnk_head* head, sllnk_node* newly)
<a name="l00340"></a>00340 {
<a name="l00341"></a>00341     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga839ab5172ceae9b8850828d733dad8bb" title="在两个节点之间插入一个新节点">sllnk_insert_between</a>(newly, head, head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00342"></a>00342 }
<a name="l00343"></a>00343 
<a name="l00349"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2552641116eba8642dd337f222c80bfb">00349</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2552641116eba8642dd337f222c80bfb" title="移除表首节点">sllnk_pop_front</a>(sllnk_head* head)
<a name="l00350"></a>00350 {
<a name="l00351"></a>00351     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga48f184f2bb9b0127577d0cf60aac9910" title="链接两个节点">sllnk_link</a>(head, head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00352"></a>00352 }
<a name="l00353"></a>00353 
<a name="l00369"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga35dc866136e1b138ae33345040d6f77c">00369</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga35dc866136e1b138ae33345040d6f77c" title="在两个节点之间插入多个连续节点">sllnk_splice_between</a>(
<a name="l00370"></a>00370     sllnk_iter prev, sllnk_iter <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>, 
<a name="l00371"></a>00371     sllnk_iter first_prev, sllnk_iter first, 
<a name="l00372"></a>00372     sllnk_iter last, sllnk_iter last_next)
<a name="l00373"></a>00373 {   <span class="comment">/* 将first节点至last节点的部分从旧表(B表)移接到新表(A表)中 </span>
<a name="l00374"></a>00374 <span class="comment">     * (从first到last是按next方向)</span>
<a name="l00375"></a>00375 <span class="comment">     * A:  -(prev)-(next)-      </span>
<a name="l00376"></a>00376 <span class="comment">     * B: -(first_prev)-(first)-...-(last)-(last_next)-</span>
<a name="l00377"></a>00377 <span class="comment">     * to:</span>
<a name="l00378"></a>00378 <span class="comment">     * A: -(prev)-(first)-...-(last)-(next)-</span>
<a name="l00379"></a>00379 <span class="comment">     * B: -(first_prev)-(last_next)-</span>
<a name="l00380"></a>00380 <span class="comment">     */</span>
<a name="l00381"></a>00381     last-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = <a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00382"></a>00382     prev-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = first;
<a name="l00383"></a>00383     first_prev-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = last_next;
<a name="l00384"></a>00384 }
<a name="l00385"></a>00385 
<a name="l00404"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaef1c4facd637f5e45cab45bb49fbde89">00404</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaef1c4facd637f5e45cab45bb49fbde89" title="在两个节点之间插入多个连续节点">sllnk_splice</a>(sllnk_iter prev, sllnk_iter pos, 
<a name="l00405"></a>00405                 sllnk_iter first_prev, sllnk_iter first, sllnk_iter last)
<a name="l00406"></a>00406 {
<a name="l00407"></a>00407     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga35dc866136e1b138ae33345040d6f77c" title="在两个节点之间插入多个连续节点">sllnk_splice_between</a>(prev, pos, first_prev, first, last, last-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00408"></a>00408 }
<a name="l00409"></a>00409 
<a name="l00416"></a>00416 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6ccd0259977fb9ff2af4ecd88b58c69a" title="统计表的节点数量">sllnk_count</a>(sllnk_head* head);
<a name="l00417"></a>00417 
<a name="l00426"></a>00426 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gab571a5517dd25a0ec46f2366cc82ceb8" title="计算两个节点的迭代距离">sllnk_distance</a>(sllnk_iter first, sllnk_iter last);
<a name="l00427"></a>00427 
<a name="l00435"></a>00435 NV_API sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2694883bb0b412a2f5cb42bd28e836f0" title="给迭代器增加一段距离或减小一段距离">sllnk_advance</a>(sllnk_iter cur, <span class="keywordtype">size_t</span> dist);
<a name="l00436"></a>00436 
<a name="l00444"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8de47ce32788fc05494a1391035a980c">00444</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8de47ce32788fc05494a1391035a980c" title="根据正向索引得到迭代器">sllnk_at</a>(sllnk_head* head, <span class="keyword">const</span> <span class="keywordtype">size_t</span> index)
<a name="l00445"></a>00445 {
<a name="l00446"></a>00446     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2694883bb0b412a2f5cb42bd28e836f0" title="给迭代器增加一段距离或减小一段距离">sllnk_advance</a>(head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>, index);
<a name="l00447"></a>00447 }
<a name="l00448"></a>00448 
<a name="l00456"></a>00456 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9716e197658ec5b83603c054f081ae5c" title="计算迭代器的正向索引">sllnk_index_of</a>(sllnk_head* head, sllnk_iter itr);
<a name="l00457"></a>00457 
<a name="l00463"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga190d801d0f6ad9a29f22d64fa4364bdb">00463</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga190d801d0f6ad9a29f22d64fa4364bdb" title="初始化节点">sllnk_node_init</a>(sllnk_node* entry)
<a name="l00464"></a>00464 {
<a name="l00465"></a>00465     entry-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = NULL;
<a name="l00466"></a>00466 }
<a name="l00467"></a>00467 
<a name="l00476"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa7ccf98727ba5b9c30c745fd3d1ca093">00476</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa7ccf98727ba5b9c30c745fd3d1ca093" title="用新节点替换目标节点">sllnk_iter_replace</a>(sllnk_node* vprev, 
<a name="l00477"></a>00477                             sllnk_node* victim, sllnk_node* newly)
<a name="l00478"></a>00478 {   <span class="comment">/* 用newly节点替换表中的victim节点</span>
<a name="l00479"></a>00479 <span class="comment">     *      (newly)                     (victim)</span>
<a name="l00480"></a>00480 <span class="comment">     *                        ===&gt;</span>
<a name="l00481"></a>00481 <span class="comment">     * --(vprev)-(victim)-()--      --(vprev)-(newly)-()--</span>
<a name="l00482"></a>00482 <span class="comment">     */</span>
<a name="l00483"></a>00483     <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga839ab5172ceae9b8850828d733dad8bb" title="在两个节点之间插入一个新节点">sllnk_insert_between</a>(newly, vprev, victim-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00484"></a>00484 }
<a name="l00485"></a>00485 
<a name="l00486"></a>00486 NV_API <span class="keywordtype">void</span> __sllnk_iter_swap(
<a name="l00487"></a>00487     sllnk_iter aprev, sllnk_iter a, sllnk_iter anext, 
<a name="l00488"></a>00488     sllnk_iter bprev, sllnk_iter b, sllnk_iter bnext);
<a name="l00489"></a>00489 
<a name="l00499"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga025032aebb054b46a91bab860f2278fe">00499</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga025032aebb054b46a91bab860f2278fe" title="交换两个节点">sllnk_iter_swap</a>(sllnk_iter aprev, sllnk_iter a, 
<a name="l00500"></a>00500                                     sllnk_iter bprev, sllnk_iter b)
<a name="l00501"></a>00501 {
<a name="l00502"></a>00502     __sllnk_iter_swap(aprev, a, a-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>, bprev, b, b-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00503"></a>00503 }
<a name="l00504"></a>00504 
<a name="l00511"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0f593516aa686d3bfc8556592adceca3">00511</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0f593516aa686d3bfc8556592adceca3" title="用新表头替换目标表头">sllnk_replace</a>(sllnk_head* victim, sllnk_head* newly)
<a name="l00512"></a>00512 {   <span class="comment">/* 用newly头替换表中的victim头</span>
<a name="l00513"></a>00513 <span class="comment">     *      [newly]                 [victim]</span>
<a name="l00514"></a>00514 <span class="comment">     *                    ===&gt;</span>
<a name="l00515"></a>00515 <span class="comment">     * --()-[victim]-()--      --()-[newly]-()--</span>
<a name="l00516"></a>00516 <span class="comment">     */</span>
<a name="l00517"></a>00517     newly-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = victim-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00518"></a>00518 }
<a name="l00519"></a>00519 
<a name="l00520"></a>00520 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __sllnk_swap(sllnk_iter a, sllnk_iter afront, 
<a name="l00521"></a>00521                                 sllnk_iter b, sllnk_iter bfront)
<a name="l00522"></a>00522 {   <span class="comment">/* 交换a、b两个头</span>
<a name="l00523"></a>00523 <span class="comment">     * [a]-(afront)--       [b]-(afront)--</span>
<a name="l00524"></a>00524 <span class="comment">     *                         ===&gt;</span>
<a name="l00525"></a>00525 <span class="comment">     * [b]-(bfront)--       [a]-(afront)--</span>
<a name="l00526"></a>00526 <span class="comment">     */</span>
<a name="l00527"></a>00527     a-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = bfront;
<a name="l00528"></a>00528     b-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = afront;
<a name="l00529"></a>00529 }
<a name="l00530"></a>00530 
<a name="l00538"></a>00538 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> sllnk_swap(sllnk_head* a, sllnk_head* b)
<a name="l00539"></a>00539 {
<a name="l00540"></a>00540     __sllnk_swap(a, a-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>, b, b-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00541"></a>00541 }
<a name="l00542"></a>00542 
<a name="l00552"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac039ab7a892f93c222db2ebd2bc9bedd">00552</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac039ab7a892f93c222db2ebd2bc9bedd" title="判断一个节点是否存在于表中">sllnk_exist</a>(sllnk_head* head, sllnk_iter itr)
<a name="l00553"></a>00553 {
<a name="l00554"></a>00554     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9716e197658ec5b83603c054f081ae5c" title="计算迭代器的正向索引">sllnk_index_of</a>(head, itr) != (size_t)(-1);
<a name="l00555"></a>00555 }
<a name="l00556"></a>00556 
<a name="l00563"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gafb2f6a5ef9f9022c078c9e14a5f17a19">00563</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gafb2f6a5ef9f9022c078c9e14a5f17a19" title="得到表首节点">sllnk_front</a>(sllnk_head* head)
<a name="l00564"></a>00564 {
<a name="l00565"></a>00565     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00566"></a>00566 }
<a name="l00567"></a>00567 
<a name="l00586"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae0332daf7a77f42da92bc167e9d1c20f">00586</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae0332daf7a77f42da92bc167e9d1c20f" title="得到指向正向起始位置的迭代器">sllnk_begin</a>(sllnk_head* head)
<a name="l00587"></a>00587 {
<a name="l00588"></a>00588     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00589"></a>00589 }
<a name="l00590"></a>00590 
<a name="l00610"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gadb1426ce49b23aa186963607e40d799f">00610</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gadb1426ce49b23aa186963607e40d799f" title="得到指向正向起始位置前驱的迭代器">sllnk_pbegin</a>(sllnk_head* head)
<a name="l00611"></a>00611 {
<a name="l00612"></a>00612     <span class="keywordflow">return</span> head;
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614 
<a name="l00621"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9405c7571626041455287739689711ed">00621</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9405c7571626041455287739689711ed" title="得到指向正向终止位置的迭代器">sllnk_end</a>()
<a name="l00622"></a>00622 {
<a name="l00623"></a>00623     <span class="keywordflow">return</span> NULL;
<a name="l00624"></a>00624 }
<a name="l00625"></a>00625 
<a name="l00632"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8531e6d10114d55255b7bb8c0f46cc56">00632</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8531e6d10114d55255b7bb8c0f46cc56" title="得到当前迭代器的正向终止位置">sllnk_end_of</a>(sllnk_iter itr)
<a name="l00633"></a>00633 {
<a name="l00634"></a>00634     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00635"></a>00635 }
<a name="l00636"></a>00636 
<a name="l00643"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga32fbba7563e8bc0df1b1ab1c5709834f">00643</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga32fbba7563e8bc0df1b1ab1c5709834f" title="得到当前节点的后继节点">sllnk_next</a>(sllnk_iter itr)
<a name="l00644"></a>00644 {
<a name="l00645"></a>00645     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00646"></a>00646 }
<a name="l00647"></a>00647 
<a name="l00648"></a>00648 <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter __sllnk_inc_later(sllnk_iter cur, sllnk_iter* p)
<a name="l00649"></a>00649 {
<a name="l00650"></a>00650     *p = cur-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>;
<a name="l00651"></a>00651     <span class="keywordflow">return</span> cur;
<a name="l00652"></a>00652 }
<a name="l00653"></a>00653 
<a name="l00662"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga66e49ff1a172491e65ca54e93028e105">00662</a> <span class="preprocessor">#define sllnk_inc(itr) ((itr) = (itr)-&gt;next)</span>
<a name="l00663"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5ad9cdcf3a9e295b51a12365f08982b4">00663</a> <span class="preprocessor"></span><span class="preprocessor">#define sllnk_prev_inc(itr, prev) ((prev) = (itr), sllnk_inc(itr))</span>
<a name="l00664"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8f56fbc2aa8e161d582839169db33ff7">00664</a> <span class="preprocessor"></span><span class="preprocessor">#define sllnk_inc_later(itr) __sllnk_inc_later(itr, &amp;(itr))</span>
<a name="l00665"></a>00665 <span class="preprocessor"></span>
<a name="l00675"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0b72121b96263415557459d60ae97111">00675</a> <span class="preprocessor">#define sllnk_foreach(_begin, _end, fn, type, member) \</span>
<a name="l00676"></a>00676 <span class="preprocessor">    do {sllnk_iter _q_e = (_end);                           \</span>
<a name="l00677"></a>00677 <span class="preprocessor">        sllnk_iter _q_f = (_begin);                         \</span>
<a name="l00678"></a>00678 <span class="preprocessor">        while (_q_f != _q_e) {                              \</span>
<a name="l00679"></a>00679 <span class="preprocessor">            type * _q_t = container_of(_q_f, type, member); \</span>
<a name="l00680"></a>00680 <span class="preprocessor">            _q_f = _q_f-&gt;next;                              \</span>
<a name="l00681"></a>00681 <span class="preprocessor">            fn(_q_t);                                       \</span>
<a name="l00682"></a>00682 <span class="preprocessor">        }                                                   \</span>
<a name="l00683"></a>00683 <span class="preprocessor">    } while (0)</span>
<a name="l00684"></a>00684 <span class="preprocessor"></span>
<a name="l00697"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga82a18806a2239e6725b743ea57d3db90">00697</a> <span class="preprocessor">#define sllnk_search(head, _begin, _end, equal, var, res, type, member) do {\</span>
<a name="l00698"></a>00698 <span class="preprocessor">        sllnk_iter _q_e = (_end);                               \</span>
<a name="l00699"></a>00699 <span class="preprocessor">        sllnk_iter _q_f = (_begin);                             \</span>
<a name="l00700"></a>00700 <span class="preprocessor">        sllnk_head* _q_h = (head);                              \</span>
<a name="l00701"></a>00701 <span class="preprocessor">        (res) = NULL;                                           \</span>
<a name="l00702"></a>00702 <span class="preprocessor">        while (_q_f != _q_e) {                                  \</span>
<a name="l00703"></a>00703 <span class="preprocessor">            type * _q_cb = container_of(_q_f, type, member);    \</span>
<a name="l00704"></a>00704 <span class="preprocessor">            if (equal(_q_cb, (val))) {                          \</span>
<a name="l00705"></a>00705 <span class="preprocessor">                (res) = _q_cb;                                  \</span>
<a name="l00706"></a>00706 <span class="preprocessor">                break;                                          \</span>
<a name="l00707"></a>00707 <span class="preprocessor">            }                                                   \</span>
<a name="l00708"></a>00708 <span class="preprocessor">            _q_f = _q_f-&gt;next;                                  \</span>
<a name="l00709"></a>00709 <span class="preprocessor">        }                                                       \</span>
<a name="l00710"></a>00710 <span class="preprocessor">    } while (0)</span>
<a name="l00711"></a>00711 <span class="preprocessor"></span>
<a name="l00712"></a>00712 <span class="comment">/* 反转链表的两种方式：</span>
<a name="l00713"></a>00713 <span class="comment"> * (1) 直接使用 sllnk_reverse(head); (推荐)</span>
<a name="l00714"></a>00714 <span class="comment"> * (2) 按照如下方式迭代</span>
<a name="l00715"></a>00715 <span class="comment"> *     sllnk_iter i = sllnk_vbegin(head);</span>
<a name="l00716"></a>00716 <span class="comment"> *     sllnk_iter e = sllnk_vend(head);</span>
<a name="l00717"></a>00717 <span class="comment"> *     while (i != e) {</span>
<a name="l00718"></a>00718 <span class="comment"> *          sllnk_vpush(head, i);</span>
<a name="l00719"></a>00719 <span class="comment"> *     }</span>
<a name="l00720"></a>00720 <span class="comment"> *     当迭代完成时，反转完成</span>
<a name="l00721"></a>00721 <span class="comment"> */</span>
<a name="l00722"></a>00722 
<a name="l00723"></a>00723 <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter __sllnk_vbegin(sllnk_head* head, sllnk_iter front)
<a name="l00724"></a>00724 {
<a name="l00725"></a>00725     head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a> = NULL;
<a name="l00726"></a>00726     <span class="keywordflow">return</span> front;
<a name="l00727"></a>00727 }
<a name="l00728"></a>00728 
<a name="l00745"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4c010000f3a7fc4d9c3ff5199896d627">00745</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4c010000f3a7fc4d9c3ff5199896d627" title="得到用于反转的起始位置的迭代器">sllnk_vbegin</a>(sllnk_head* head)
<a name="l00746"></a>00746 {
<a name="l00747"></a>00747     <span class="keywordflow">return</span> __sllnk_vbegin(head, head-&gt;<a class="code" href="struct____sllnk__node.html#a8442b9c6239b7f8b26caeaf3afe49966" title="后继节点">next</a>);
<a name="l00748"></a>00748 }
<a name="l00749"></a>00749 
<a name="l00766"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga169be3d345b481c5c2655abbfd663826">00766</a> <span class="keyword">static</span> <span class="keyword">inline</span> sllnk_iter <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga169be3d345b481c5c2655abbfd663826" title="得到用于反转的终止位置的迭代器">sllnk_vend</a>(sllnk_head* head)
<a name="l00767"></a>00767 {
<a name="l00768"></a>00768     <span class="keywordflow">return</span> head;
<a name="l00769"></a>00769 }
<a name="l00770"></a>00770 
<a name="l00787"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3cc566e864a08f9a5d5aae4ccb525768">00787</a> <span class="preprocessor">#define sllnk_vpush(head, itr) sllnk_push_front(head, sllnk_inc_later(itr))</span>
<a name="l00788"></a>00788 <span class="preprocessor"></span>
<a name="l00795"></a>00795 NV_API <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga71dc4ef578add6513b4eb045b41dcecb" title="反转表">sllnk_reverse</a>(sllnk_head* head);
<a name="l00796"></a>00796 
<a name="l00797"></a>00797 NV_API <span class="keywordtype">void</span> __sllnk_serialize(sllnk_head* head, <span class="keywordtype">char</span>** buf, 
<a name="l00798"></a>00798                             <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset);
<a name="l00799"></a>00799 
<a name="l00800"></a>00800 NV_API <span class="keywordtype">void</span> __sllnk_deserialize(sllnk_head* head, <span class="keywordtype">char</span>** buf, 
<a name="l00801"></a>00801                             <span class="keywordtype">size_t</span> cnt, <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset);
<a name="l00802"></a>00802 
<a name="l00832"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3accd691a53c124906fcbc1193c479fe">00832</a> <span class="preprocessor">#define sllnk_serialize(head, buf, type, member) \</span>
<a name="l00833"></a>00833 <span class="preprocessor">    __sllnk_serialize(head, (char**)(buf), offset_of(type, member))</span>
<a name="l00834"></a>00834 <span class="preprocessor"></span>
<a name="l00865"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac4c1d75fd2b796cc96095c076e0c5b24">00865</a> <span class="preprocessor">#define sllnk_deserialize(head, buf, cnt, type, member) \</span>
<a name="l00866"></a>00866 <span class="preprocessor">    __sllnk_deserialize(head, (char**)(buf), cnt, offset_of(type, member))</span>
<a name="l00867"></a>00867 <span class="preprocessor"></span>
<a name="l00879"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gabdd7cb94ea6a866fa1e255e34b6b49cc">00879</a> <span class="preprocessor">#define sllnk_sort_insert(head, newly, greater_equal, type, member) do {\</span>
<a name="l00880"></a>00880 <span class="preprocessor">        sllnk_iter _k_n = (newly);                              \</span>
<a name="l00881"></a>00881 <span class="preprocessor">        sllnk_head* _k_h = (head);                              \</span>
<a name="l00882"></a>00882 <span class="preprocessor">        sllnk_iter _k_j = _k_h;                                 \</span>
<a name="l00883"></a>00883 <span class="preprocessor">        sllnk_iter _k_i = _k_h-&gt;next;                           \</span>
<a name="l00884"></a>00884 <span class="preprocessor">        while (_k_i != _k_h) {                                  \</span>
<a name="l00885"></a>00885 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l00886"></a>00886 <span class="preprocessor">            type * _k_pn = container_of(_k_n, type, member);    \</span>
<a name="l00887"></a>00887 <span class="preprocessor">            if (greater_equal(_k_pi, _k_pn))                    \</span>
<a name="l00888"></a>00888 <span class="preprocessor">                break;                                          \</span>
<a name="l00889"></a>00889 <span class="preprocessor">            _k_j = _k_i;                                        \</span>
<a name="l00890"></a>00890 <span class="preprocessor">            _k_i = _k_i-&gt;next;                                  \</span>
<a name="l00891"></a>00891 <span class="preprocessor">        }                                                       \</span>
<a name="l00892"></a>00892 <span class="preprocessor">        sllnk_insert(_k_j, _k_i, _k_n);                         \</span>
<a name="l00893"></a>00893 <span class="preprocessor">    } while (0)</span>
<a name="l00894"></a>00894 <span class="preprocessor"></span>
<a name="l00909"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae81b65037e8dfc7fb53a6bc284787079">00909</a> <span class="preprocessor">#define sllnk_is_sorted(_begin, _end, greater_equal, res, type, member) do {\</span>
<a name="l00910"></a>00910 <span class="preprocessor">        sllnk_iter _k_e = (_end);                               \</span>
<a name="l00911"></a>00911 <span class="preprocessor">        sllnk_iter _k_i = (_begin);                             \</span>
<a name="l00912"></a>00912 <span class="preprocessor">        sllnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l00913"></a>00913 <span class="preprocessor">        (res) = 1;                                              \</span>
<a name="l00914"></a>00914 <span class="preprocessor">        while (_k_j != _k_e) {                                  \</span>
<a name="l00915"></a>00915 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l00916"></a>00916 <span class="preprocessor">            type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l00917"></a>00917 <span class="preprocessor">            if (!(greater_equal(_k_pj, _k_pi))) {               \</span>
<a name="l00918"></a>00918 <span class="preprocessor">                (res) = 0;                                      \</span>
<a name="l00919"></a>00919 <span class="preprocessor">                break;                                          \</span>
<a name="l00920"></a>00920 <span class="preprocessor">            }                                                   \</span>
<a name="l00921"></a>00921 <span class="preprocessor">            _k_i = _k_j;                                        \</span>
<a name="l00922"></a>00922 <span class="preprocessor">            _k_j = _k_j-&gt;next;                                  \</span>
<a name="l00923"></a>00923 <span class="preprocessor">        }                                                       \</span>
<a name="l00924"></a>00924 <span class="preprocessor">    } while (0)</span>
<a name="l00925"></a>00925 <span class="preprocessor"></span>
<a name="l00926"></a>00926 <span class="comment">/* 单向线形链表排序性能比较</span>
<a name="l00927"></a>00927 <span class="comment"> * 随机数据：(最高) 插入排序 &gt;&gt; 选择排序 &gt;&gt; 冒泡排序 &gt; 鸡尾酒排序 &gt; 奇偶排序 (最低)</span>
<a name="l00928"></a>00928 <span class="comment"> * 顺序数据：(最高) 冒泡排序 &gt; 奇偶排序 &gt; 鸡尾酒排序 &gt;&gt; 插入排序 &gt; 选择排序  (最低)</span>
<a name="l00929"></a>00929 <span class="comment"> * 逆序数据：(最高) 插入排序 &gt;&gt; 选择排序 &gt;&gt; 冒泡排序 &gt; 鸡尾酒排序 &gt; 奇偶排序  (最低)</span>
<a name="l00930"></a>00930 <span class="comment"> */</span>
<a name="l00931"></a>00931 
<a name="l00945"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae7eec31cbfd41f487ae7aa14322411aa">00945</a> <span class="preprocessor">#define sllnk_bubble_sort(bprev, _begin, _end, greater, type, member) do {\</span>
<a name="l00946"></a>00946 <span class="preprocessor">        int _k_pc = 1;                                              \</span>
<a name="l00947"></a>00947 <span class="preprocessor">        sllnk_iter _k_e = (_end);                                   \</span>
<a name="l00948"></a>00948 <span class="preprocessor">        sllnk_iter _k_i = (_begin);                                 \</span>
<a name="l00949"></a>00949 <span class="preprocessor">        sllnk_iter _k_ip = (bprev);                                 \</span>
<a name="l00950"></a>00950 <span class="preprocessor">        for (; _k_pc &amp;&amp; _k_i != _k_e; _k_i = _k_i-&gt;next) {          \</span>
<a name="l00951"></a>00951 <span class="preprocessor">            sllnk_iter _k_jp = _k_i;                                \</span>
<a name="l00952"></a>00952 <span class="preprocessor">            sllnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l00953"></a>00953 <span class="preprocessor">            for (_k_pc = 0; _k_j != _k_e; _k_j = _k_j-&gt;next) {      \</span>
<a name="l00954"></a>00954 <span class="preprocessor">                type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l00955"></a>00955 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l00956"></a>00956 <span class="preprocessor">                if (greater(_k_pi, _k_pj)) {                        \</span>
<a name="l00957"></a>00957 <span class="preprocessor">                    sllnk_iter _k_t = _k_i;                         \</span>
<a name="l00958"></a>00958 <span class="preprocessor">                    _k_i = _k_j;                                    \</span>
<a name="l00959"></a>00959 <span class="preprocessor">                    _k_j = _k_t;                                    \</span>
<a name="l00960"></a>00960 <span class="preprocessor">                    sllnk_iter_swap(_k_jp, _k_i, _k_ip, _k_j);      \</span>
<a name="l00961"></a>00961 <span class="preprocessor">                    _k_pc = 1;                                      \</span>
<a name="l00962"></a>00962 <span class="preprocessor">                }                                                   \</span>
<a name="l00963"></a>00963 <span class="preprocessor">                _k_jp = _k_j;                                       \</span>
<a name="l00964"></a>00964 <span class="preprocessor">            }                                                       \</span>
<a name="l00965"></a>00965 <span class="preprocessor">            _k_ip = _k_i;                                           \</span>
<a name="l00966"></a>00966 <span class="preprocessor">        }                                                           \</span>
<a name="l00967"></a>00967 <span class="preprocessor">    } while (0)</span>
<a name="l00968"></a>00968 <span class="preprocessor"></span>
<a name="l00982"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9ed645e7bd4da0be5b3e862cd8069f46">00982</a> <span class="preprocessor">#define sllnk_oddeven_sort(bprev, _begin, _end, greater, type, member) do {\</span>
<a name="l00983"></a>00983 <span class="preprocessor">        int _k_pc = 1;                                                      \</span>
<a name="l00984"></a>00984 <span class="preprocessor">        sllnk_iter _k_e = (_end);                                           \</span>
<a name="l00985"></a>00985 <span class="preprocessor">        sllnk_iter _k_f = (_begin);                                         \</span>
<a name="l00986"></a>00986 <span class="preprocessor">        sllnk_iter _k_p = (bprev);                                          \</span>
<a name="l00987"></a>00987 <span class="preprocessor">        while (_k_pc) {                                                     \</span>
<a name="l00988"></a>00988 <span class="preprocessor">            _k_pc = 0;                                                      \</span>
<a name="l00989"></a>00989 <span class="preprocessor">            _k_f = _k_p-&gt;next;                                              \</span>
<a name="l00990"></a>00990 <span class="preprocessor">            __sllnk_oddeven_scan(greater, type, member, _k_p, _k_f);        \</span>
<a name="l00991"></a>00991 <span class="preprocessor">            __sllnk_oddeven_scan(greater, type, member, _k_f, _k_f-&gt;next);  \</span>
<a name="l00992"></a>00992 <span class="preprocessor">        }                                                                   \</span>
<a name="l00993"></a>00993 <span class="preprocessor">    } while (0)</span>
<a name="l00994"></a>00994 <span class="preprocessor"></span>
<a name="l00995"></a>00995 <span class="preprocessor">#define __sllnk_oddeven_scan(greater, type, member, prev, _start) do {\</span>
<a name="l00996"></a>00996 <span class="preprocessor">        sllnk_iter _k_ip = prev;                                \</span>
<a name="l00997"></a>00997 <span class="preprocessor">        sllnk_iter _k_i = _start;                               \</span>
<a name="l00998"></a>00998 <span class="preprocessor">        sllnk_iter _k_jp = _k_i;                                \</span>
<a name="l00999"></a>00999 <span class="preprocessor">        sllnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l01000"></a>01000 <span class="preprocessor">        while (_k_j != _k_e) {                                  \</span>
<a name="l01001"></a>01001 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l01002"></a>01002 <span class="preprocessor">            type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01003"></a>01003 <span class="preprocessor">            if (greater(_k_pi, _k_pj)) {                        \</span>
<a name="l01004"></a>01004 <span class="preprocessor">                sllnk_iter _k_t = _k_i;                         \</span>
<a name="l01005"></a>01005 <span class="preprocessor">                _k_i = _k_j;                                    \</span>
<a name="l01006"></a>01006 <span class="preprocessor">                _k_j = _k_t;                                    \</span>
<a name="l01007"></a>01007 <span class="preprocessor">                sllnk_iter_swap(_k_jp, _k_i, _k_ip, _k_j);      \</span>
<a name="l01008"></a>01008 <span class="preprocessor">                _k_pc = 1;                                      \</span>
<a name="l01009"></a>01009 <span class="preprocessor">            }                                                   \</span>
<a name="l01010"></a>01010 <span class="preprocessor">            if (!_k_j) break;                                   \</span>
<a name="l01011"></a>01011 <span class="preprocessor">            _k_ip = _k_j;                                       \</span>
<a name="l01012"></a>01012 <span class="preprocessor">            _k_i = _k_j-&gt;next;                                  \</span>
<a name="l01013"></a>01013 <span class="preprocessor">            if (!_k_i) break;                                   \</span>
<a name="l01014"></a>01014 <span class="preprocessor">            _k_jp = _k_i;                                       \</span>
<a name="l01015"></a>01015 <span class="preprocessor">            _k_j = _k_i-&gt;next;                                  \</span>
<a name="l01016"></a>01016 <span class="preprocessor">        }                                                       \</span>
<a name="l01017"></a>01017 <span class="preprocessor">    } while (0)</span>
<a name="l01018"></a>01018 <span class="preprocessor"></span>
<a name="l01032"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5fa4d81762787f660e71b5176c4013f6">01032</a> <span class="preprocessor">#define sllnk_select_sort(bprev, _begin, _end, greater, type, member) do {\</span>
<a name="l01033"></a>01033 <span class="preprocessor">        sllnk_iter _k_e = (_end);                                   \</span>
<a name="l01034"></a>01034 <span class="preprocessor">        sllnk_iter _k_i = (_begin);                                 \</span>
<a name="l01035"></a>01035 <span class="preprocessor">        sllnk_iter _k_ip = (bprev);                                 \</span>
<a name="l01036"></a>01036 <span class="preprocessor">        sllnk_iter _k_jp = _k_i;                                    \</span>
<a name="l01037"></a>01037 <span class="preprocessor">        sllnk_iter _k_j = _k_i-&gt;next;                               \</span>
<a name="l01038"></a>01038 <span class="preprocessor">        while (_k_j != _k_e) {                                      \</span>
<a name="l01039"></a>01039 <span class="preprocessor">            sllnk_iter _k_mp = _k_ip;                               \</span>
<a name="l01040"></a>01040 <span class="preprocessor">            sllnk_iter _k_m = _k_i;                                 \</span>
<a name="l01041"></a>01041 <span class="preprocessor">            while (_k_j != _k_e) {                                  \</span>
<a name="l01042"></a>01042 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01043"></a>01043 <span class="preprocessor">                type * _k_pm = container_of(_k_m, type, member);    \</span>
<a name="l01044"></a>01044 <span class="preprocessor">                if (greater(_k_pm, _k_pj)) {                        \</span>
<a name="l01045"></a>01045 <span class="preprocessor">                    _k_mp = _k_jp;                                  \</span>
<a name="l01046"></a>01046 <span class="preprocessor">                    _k_m = _k_j;                                    \</span>
<a name="l01047"></a>01047 <span class="preprocessor">                }                                                   \</span>
<a name="l01048"></a>01048 <span class="preprocessor">                _k_jp = _k_j;                                       \</span>
<a name="l01049"></a>01049 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                  \</span>
<a name="l01050"></a>01050 <span class="preprocessor">            }                                                       \</span>
<a name="l01051"></a>01051 <span class="preprocessor">            if (_k_i != _k_m) {                                     \</span>
<a name="l01052"></a>01052 <span class="preprocessor">                sllnk_iter _k_t = _k_m;                             \</span>
<a name="l01053"></a>01053 <span class="preprocessor">                _k_m = _k_i;                                        \</span>
<a name="l01054"></a>01054 <span class="preprocessor">                _k_i = _k_t;                                        \</span>
<a name="l01055"></a>01055 <span class="preprocessor">                sllnk_iter_swap(_k_ip, _k_m, _k_mp, _k_i);          \</span>
<a name="l01056"></a>01056 <span class="preprocessor">            }                                                       \</span>
<a name="l01057"></a>01057 <span class="preprocessor">            _k_ip = _k_i;                                           \</span>
<a name="l01058"></a>01058 <span class="preprocessor">            _k_i = _k_i-&gt;next;                                      \</span>
<a name="l01059"></a>01059 <span class="preprocessor">            _k_jp = _k_i;                                           \</span>
<a name="l01060"></a>01060 <span class="preprocessor">            _k_j = _k_i-&gt;next;                                      \</span>
<a name="l01061"></a>01061 <span class="preprocessor">        }                                                           \</span>
<a name="l01062"></a>01062 <span class="preprocessor">    } while (0)</span>
<a name="l01063"></a>01063 <span class="preprocessor"></span>
<a name="l01076"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_xBA_xBF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa38a8df25dd9a93ac472d20d647afc98">01076</a> <span class="preprocessor">#define sllnk_insert_sort(bprev, _begin, _end, greater_equal, type, member) \</span>
<a name="l01077"></a>01077 <span class="preprocessor">    do {sllnk_iter _k_e = (_end);                                   \</span>
<a name="l01078"></a>01078 <span class="preprocessor">        sllnk_iter _k_f = (_begin);                                 \</span>
<a name="l01079"></a>01079 <span class="preprocessor">        sllnk_iter _k_p = (bprev);                                  \</span>
<a name="l01080"></a>01080 <span class="preprocessor">        sllnk_iter _k_ip = _k_f;                                    \</span>
<a name="l01081"></a>01081 <span class="preprocessor">        sllnk_iter _k_i = _k_f-&gt;next;                               \</span>
<a name="l01082"></a>01082 <span class="preprocessor">        for (; _k_i != _k_e; _k_i = _k_i-&gt;next) {                   \</span>
<a name="l01083"></a>01083 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);        \</span>
<a name="l01084"></a>01084 <span class="preprocessor">            sllnk_iter _k_jp = _k_p;                                \</span>
<a name="l01085"></a>01085 <span class="preprocessor">            sllnk_iter _k_j = _k_p-&gt;next;                           \</span>
<a name="l01086"></a>01086 <span class="preprocessor">            while (_k_j != _k_i) {                                  \</span>
<a name="l01087"></a>01087 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01088"></a>01088 <span class="preprocessor">                if (greater_equal(_k_pj, _k_pi)) {                  \</span>
<a name="l01089"></a>01089 <span class="preprocessor">                    sllnk_iter _k_t = _k_i;                         \</span>
<a name="l01090"></a>01090 <span class="preprocessor">                    _k_i = _k_ip;                                   \</span>
<a name="l01091"></a>01091 <span class="preprocessor">                    sllnk_erase(_k_ip, _k_t);                       \</span>
<a name="l01092"></a>01092 <span class="preprocessor">                    sllnk_insert(_k_jp, _k_j, _k_t);                \</span>
<a name="l01093"></a>01093 <span class="preprocessor">                    break;                                          \</span>
<a name="l01094"></a>01094 <span class="preprocessor">                }                                                   \</span>
<a name="l01095"></a>01095 <span class="preprocessor">                _k_jp = _k_j;                                       \</span>
<a name="l01096"></a>01096 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                  \</span>
<a name="l01097"></a>01097 <span class="preprocessor">            }                                                       \</span>
<a name="l01098"></a>01098 <span class="preprocessor">            _k_ip = _k_i;                                           \</span>
<a name="l01099"></a>01099 <span class="preprocessor">        }                                                           \</span>
<a name="l01100"></a>01100 <span class="preprocessor">    } while (0)</span>
<a name="l01101"></a>01101 <span class="preprocessor"></span>
<a name="l01104"></a>01104 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l01105"></a>01105 <span class="preprocessor"></span>}
<a name="l01106"></a>01106 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l01107"></a>01107 
<a name="l01108"></a>01108 <span class="preprocessor">#endif </span><span class="comment">/* #ifndef __NV_SLLNK__ */</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:37 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
